//
//  ViewController.m
//  newProject
//
//  Created by  Mac on 2017/8/25.
//  Copyright © 2017年  Mac. All rights reserved.
//

#import "ViewController.h"

#import "CocoaRedis.h"

@interface ViewController ()
//主机
@property(nonatomic,strong)NSString * host;
//端口号
@property(nonatomic,assign)int port;
//连接密码
@property(nonatomic,strong)NSString * yourPassword;

@property(nonatomic,strong)NSString * key;

@property(nonatomic,strong)NSString * value;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    CocoaRedis *redis = [CocoaRedis new];

    // Connect to server
    [[[[redis connectWithHost:_host port:_port] then:^id(id value) {
        return [redis auth: _yourPassword];
    }] then:^id(id value) {
// 关于rpush方法是试出来的 看服务端的需要  这个其实也没弄明白
// 关于参数 公司项目用的是key是一个字符串@"order_1234" value是@"[114.00000,22.00000]" 这样的格式
        return [redis rpush:_key value:_value];
        
    }] catch:^id(NSError *err) {
        NSLog(@"Error: %@", err);
        return nil;
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
